##########################################################################################

library(data.table)
library(VennDiagram)

##########################################################################################

option_list <- list(
    make_option(c("--njmu_file"), type = "character") ,
    make_option(c("--tcga_file"), type = "character") ,
    make_option(c("--oncoSG_file"), type = "character") ,
    make_option(c("--out_path"), type = "character")
)

if(1!=1){
    
    sig_cancer_file <- "~/20220915_gastric_multiple/dna_combine/mutsig_check/cancer/cancer.smg.list"
    sig_pre_file <- "~/20220915_gastric_multiple/dna_combine/mutsig_check/precancer/precancer.smg.list"
    out_path <- "~/20220915_gastric_multiple/dna_combine/images/venn_gene"
}

###########################################################################################

parseobj <- OptionParser(option_list=option_list, usage = "usage: Rscript %prog [options]")
opt <- parse_args(parseobj)
print(opt)

njmu_file <- opt$njmu_file
tcga_file <- opt$tcga_file
oncoSG_file <- opt$oncoSG_file
out_path <- opt$out_path

dir.create(out_path , recursive = T)

###########################################################################################

dat_cancer <- data.frame(fread(sig_cancer_file , header = F))
dat_pre <- data.frame(fread(sig_pre_file , header = F))

lis <- list(GC_SMG = dat_cancer$V1 , IM_SMG = dat_pre$V1 )

venn.plot <- venn.diagram(
  lis ,
  filename = NULL,
  lwd = 5,  # 圈线条粗细 1 2 3 4 5
  lty = 1,  # 线条类型, 1 实线, 2 虚线, blank 无线条
  col = c("red", 'blue'),  # 线条色
  alpha = 0.5
)

out_name <- paste0(out_path , "/venn_gene.pdf")
pdf(out_name)
grid.draw(venn.plot)
dev.off()